<?php use_helper('Date', 'Text') ?>
<?php slot('title', $post->getTitle()) ?>
<?php slot('main_title', $post->getTitle()) ?>
<?php slot('keywords', $post->getTags()) ?>

<?php include_partial('post', array('post' => $post, 'showBody' => true)) ?>

<h2><?php echo __('Comments') ?></h2>

<?php if (!count($comments = $post->getPublishedComments())) : ?>
<div class="pagination_desc">
  <?php echo __('There is no comment yet') ?>
</div>
<?php else : ?>
<div class="comments">
  <?php foreach ($comments as $i => $comment) : ?>
  <div class="comment" id="comment_<?php echo $comment->getId() ?>">
    <p class="comment-meta">
      <?php echo __('Posted by %author%', array('%author%' => $comment->getName())) ?> - 
      <?php echo __('About %time% ago.', array('%time%' => time_ago_in_words($comment->getDateTimeObject('created_at')->format('U')))) ?>
    </p>
    <div>
      <?php echo nl2br($comment->getSourceContent()) ?>
    </div>
  </div>
  <?php endforeach ?>
</div>
<?php endif ?>

<h2><?php echo __('Leave a comment') ?></h2>

<?php if (!$post->isCommentable()) : ?>
<p>
  <?php echo __('Comments are closed for this post.') ?>
</p>
<?php else: ?>
  <?php include_component('comment', 'form', array(
    'action' => url_for('post_add_comment', $post),
    'post' => $post
  )) ?>
<?php endif ?>